#include <stdio.h>
#define MAXSIZE 20         //设记录不超过20个
typedef int KeyType;       //设关键字的类型为整型
typedef char InfoType;       //设关键字的类型为整型

typedef struct             //定义每个记录的结构
{
    KeyType key;           //关键字
    InfoType otherInfo;    //其他数据项
}RedType;

typedef RedType SqList[MAXSIZE + 1];

/**
 * 直接插入排序
 * @param R
 * @param n
 */
void straight_insert_sort(SqList R, int n) {
    int i, j;
    for (i = 2; i <= n; i++) {
        R[0] = R[i];
        for (j = i-1; R[0].key<R[j].key; j--){
            R[j+1] =R[j];
        }
        R[j+1] = R[0];
    }
}

//
void bubbleSort(SqList R,int length)
{
    int change = 1;

    for (int i = 0; i != length-1 && change; ++i)
    {
        change = 0;

        for (int j = 0; j != length-i-1; ++j)
        {
//            if (R[j] > R[j+1])  // 如果相邻元素中大者在前, 交换之
//            {
//                R[0] = R[j];
//                R[j] = R[j+1];
//                R[j+1] =  R[0];
//
//                change = 1;
//            }
        }
    }
}

void BubbleSort(SqList R, int n){
    int i, j, temp, endsort;
    for (i=1; i<=n; i++){ //排序次序
        endsort = 0;//在每次排序之前，先将它设置为0，若在
    }
}

void Merge(RecType R[], RecType DR[], int k, int m, int h)
{
    int p, q, n;
    p = n = k, q = m + 1;

    while ((p <= m) && (q <= h)) {
        if (LQ(R[p].key, R[q].key)) /* 比较两个子序列 */

            DR[n++] = R[p++];

        else DR[n++] = R[q++];

    }

    while (p <= m) /* 将剩余子序列复制到结果序列中 */
        DR[n++] = R[p++];
    while (q <= h)
        DR[n++] = R[q++];

}

void Merge_pass(RecType R[], RecType DR[], int d, int n) {
    int j = 1;
    while ((j + 2 * d - 1) <= n) {
        Merge(R, DR, j, j + d - 1, j + 2 * d - 1);
        j = j + 2 * d;
    } /* 子序列两两归并 */
    if (j + d - 1 < n) /* 剩余元素个数超过一个子序列长度 d */
        Merge(R, DR, j, j + d - 1, n);
    else Merge(R, DR, j, n, n);/* 剩余子序列复制 */
}

void Merge_sort(Sqlist *L, RecType DR[]) {
    int d = 1;
    while (d < L->length) {
        Merge_pass(L->R, DR, d, L->length);
        Merge_pass(DR, L->R, 2 * d, L->length);
        d = 4 * d;
    }
}

int main()
{
    SqList R;
    int n =5;
    int x;
    for(int i=1; i<=5; i++){
        scanf("%d", &x);
        R[i].key = x;
    }
//    straight_insert_sort(R, n);
    bubbleSort(R, n);
    for(int i=1; i<=5; i++){
        printf("%d", R[i].key);
    }
    return 0;
}